package io;

import java.io.*;

/**
 * 缓冲流: java.io. BufferedInputStream和java.io.BufferedOutputStream
 *             缓冲字节输入流                      缓冲字节输出
 * 流缓冲流是一对高级流,在流连接中的作用是提高读写效率
 */
public class CopyDemo3 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("note.txt");
        BufferedInputStream bis = new BufferedInputStream(fis,1024*10);
        FileOutputStream fos = new FileOutputStream("note1.txt");
        BufferedOutputStream bos = new BufferedOutputStream(fos,1024*10);
        int a = 0;
        long start = System.currentTimeMillis();
        while ((a = bis.read()) != -1){
            bos.write(a);
        }
        bos.close();
        bis.close();
        long end = System.currentTimeMillis();
        System.out.println("复制完毕，用时："+(end-start)+"ms");
    }
}
